<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/jsp/common/common.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

%>
<html>
	<head>	
		<title>检修方案</title>
		<script type="text/javascript" src="<%=contextPath%>/js/validator.js"></script>
		<script type="text/javascript" src="<%=contextPath%>/js/My97DatePicker/WdatePicker.js"></script>
		<script type="text/javascript">
			Ext.onReady(function(){
				//var whichmenu = $("#searchBean.con20").val();
				var tb = new Ext.Toolbar({
			   		renderTo: document.all.tbar,
			    	items: [
				       {
				            text: '保存',
				            icon:"<%=contextPath%>/images/save.gif",
				            handler:function(){
				            	comt();
				            }
				        },'-',
				        {
				            text: '返回',
				            icon:"<%=contextPath%>/images/fanhui.png",
				            handler:function(){
				            	back();
				            }
				        }
			    	]
			    });
			});
			
			function getprojectinfo(){
			window.open("<%=contextPath%>/projectImplement!findByUnitno.do", '统计表格', 'height=300, width=350, top=200, left=300, toolbar=no, menubar=no');
			// document.frmM.action = "<%=contextPath%>/projectImplement!findByUnitno";
			}
		</script>
	</head>
  
  <body topmargin="0">
  <div id = "tbar"></div>
  <center>
			<!-- 信息提示 -->
			<div result><font color="red">${info }</font></div>
		</center>
 		<form id="frmM" class="ct" name="frmM" method="POST" action="<%=contextPath%>/projectImplement!save.do">
 			<input type="hidden" id="hiddenids" name="hiddenids" value="${hiddenids}"/>
 			<input type="hidden" id="searchBean.con20" name="searchBean.con20" value="${searchBean.con20}"/>
 			<input type="hidden" id="entity.id" name="entity.id" value="${entity.id}"/>
 			<input type="hidden" id="entity.status" name="entity.status" value="${entity.status}"/>
 			
			<table width="100%" id="infotab">
				<tr>
					<th>方案名称</th>
					<td colspan="5">
						<input type="text" name="entity.famc" id="entity.famc" value="${entity.famc}"/>
					</td>
				</tr>
				<tr>
					<th >审核</th>
					<td><input type="text" name="entity.shname" id="entity.shname" value="${entity.shname}"/>
					<th >编写</th>
					<td><input type="text" name="entity.bxname" id="entity.bxname" value="${entity.bxname}"/>					
				</tr>
				<tr>
					<th >停电时间</th>
					<td colspan="5">
						<input type="text"  readonly="true" onclick="WdatePicker({el:$dp.$('entity.tdsj')})" name="entity.tdsj" id="entity.tdsj" value=${entity.tdsj}>
						<img onclick="WdatePicker({dateFmt:'yyyy-MM-dd',el:$dp.$('entity.tdsj')})" src="<%=contextPath%>/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
					</td>
				</tr>
				<tr><th >安全措施</th></tr>
				<tr><td><textarea id="entity.aqcs" name="entity.aqcs" rows="5" cols="40">${entity.aqcs}</textarea></td></tr>
			</table>				
			<hr>
			<table width="100%" id="listtab" class = "leadertab" >
				<tr><td colspan="3"> 组织措施 </td></tr>
				<tr>
					<th width="150">总负责人</th>
					<td>
						<input type="text" name="entity.zfzr" id="entity.zfzr" value="${entity.zfzr}"/>
					</td>
				</tr>
				<tr>
					<th width="150">班组</th>
					<th width="150">负责人</th>
					<th>成员</th>
				</tr>

				<c:forEach items="${jxfaBzList}" var="detail" varStatus="status">
					<tr id='tr${status.index}' class = "repeat">
						<td width="150" >
							<input type="hidden" id="jxfaBzList[${status.index}].jxfaid" name="jxfaBzList[${status.index}].jxfaid" value = "${detail.jxfaid}"/>
							<input type="hidden" id="jxfaBzList[${status.index}].id" name="jxfaBzList[${status.index}].id" value = "${detail.id}"/>
							<input type="hidden" id="jxfaBzList[${status.index}].bzid" name="jxfaBzList[${status.index}].bzid" value = "${detail.bzid}"/>
							<input type="text" readonly="true" style="width:90%" id="jxfaBzList[${status.index}].bzname" name="jxfaBzList[${status.index}].bzname" value = "${detail.bzname}"/>
						</td>
						<td width="150">
							<input type="hidden" id="jxfaBzList[${status.index}].fzrid" name="jxfaBzList[${status.index}].fzrid" value = "${detail.fzrid}"/>
							<input type="text" readonly="true" style="width:80%" id="jxfaBzList[${status.index}].fzrname" name="jxfaBzList[${status.index}].fzrname" value = "${detail.fzrname}"/>
							<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getUser('jxfaBzList[${status.index}].fzrid','jxfaBzList[${status.index}].fzrname','detail.bzid')" />
						</td>
						<td >
							<input type="hidden" id="jxfaBzList[${status.index}].cyid" name="jxfaBzList[${status.index}].cyid" value = "${detail.cyid}"/>
							<input type="text" readonly="true" style="width:80%" id="jxfaBzList[${status.index}].cyname" name="jxfaBzList[${status.index}].cyname" value = "${detail.cyname}"/>
							<img style='cursor:pointer' src="<%=contextPath%>/images/editlink.gif" title="" onClick="javascript:getUser('jxfaBzList[${status.index}].cyid','jxfaBzList[${status.index}].cyname','detail.bzid')" />
						</td>
					</tr>
				</c:forEach>			
			</table>
			<table width="100%" id="listtab" class="thirdTab">
				<tr>
					<th colspan="5">检修项目及安排</th>
				</tr>
				<tr>
					<th width="150">总体工作内容</th>
					<td colspan="5" style="text-align: left;"><input type="text" size="150" name="entity.ztgznr" id="entity.ztgznr" value="${entity.ztgznr}"/></td>	
				</tr>
				<tr>
					<th width="150">日期</th>
					<th width="200">班组</th>
					<th width="300">内容</th>
					<th width="200">工作要求</th>					
					<th>车辆及用工</th>
					<th><img id="imgid" onclick="addGznr()" src="<%=contextPath%>/images/add.gif" align="absmiddle"></th>
				</tr>
				<c:forEach items="${jxfaGznrList}" var="gznr" varStatus="status">
					<tr id='tr${status.index}' class = "repeat">
						<td></td>
						<td width="150" >
							<input type="text" id="jxfaGznrList[${status.index}].rq" name="jxfaGznrList[${status.index}].rq" value="${gznr.rq}" />
						</td>
						<td width="150">
							<input type="text" id="jxfaGznrList[${status.index}].bzname" name="jxfaGznrList[${status.index}].bzname" value="${gznr.bzname}" />
						</td>
						<td >
							<input type="text" id="jxfaGznrList[${status.index}].nr" name="jxfaGznrList[${status.index}].nr" value="${gznr.nr}"/>
						</td>
						<td width="150">
							<input type="text" id="jxfaGznrList[${status.index}].gzyq" name="jxfaGznrList[${status.index}].gzyq" value="${gznr.gzyq}"/>
						</td>	
						<td width="150">
							<input type="text" id="jxfaGznrList[${status.index}].clyg" name="jxfaGznrList[${status.index}].clyg" value="${gznr.clyg}"/>
						</td>											
					</tr>
				</c:forEach>				
			</table>			
   </form>
  </body>
</html>
<script language="javascript">
	 // 保存
	 var count = 0;
     function comt(){
        if(!Validator.Validate(frmM,1)){
			return false;
		}
     	document.frmM.action = "<%=contextPath%>/jxfa!saveJxfa.do";
     	document.frmM.submit();
     }
     // 返回
     function back() {
        location.href = "<%=contextPath%>/planList!getList.do?"
     }
     
     function addGznr(){
     	var tr = '<tr>' +
     			  	'<td><input type="text" id="jxfaGznrList[' + count + '].rq" name="jxfaGznrList[' + count + '].rq" /></td>' +
     			  	'<td><input type="text" id="jxfaGznrList[' + count + '].bzname" name="jxfaGznrList[' + count + '].bzname" /></td>' +
     			  	'<td><input type="text" id="jxfaGznrList[' + count + '].nr" name="jxfaGznrList[' + count + '].nr" /></td>' +
     			  	'<td><input type="text" id="jxfaGznrList[' + count + '].gzyq" name="jxfaGznrList[' + count + '].gzyq" /></td>' +
     			  	'<td><input type="text" id="jxfaGznrList[' + count + '].clyg" name="jxfaGznrList[' + count + '].clyg" /></td>' +
     			 '</tr>';
    	$(".thirdTab").append(tr);
    	count ++ ;
     }
 
</script>
